package com.ruoyi.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.domain.T19;
import com.ruoyi.service.IT19Service;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 授权日志Controller
 * 
 * @author ruoyi
 * @date 2024-08-02
 */
@RestController
@RequestMapping("/authorizationLog/authorizationLog")
public class T19Controller extends BaseController
{
    @Autowired
    private IT19Service t19Service;

    /**
     * 查询授权日志列表
     */
    @PreAuthorize("@ss.hasPermi('authorizationLog:authorizationLog:list')")
    @GetMapping("/list")
    public TableDataInfo list(T19 t19)
    {
        startPage();
        List<T19> list = t19Service.selectT19List(t19);
        return getDataTable(list);
    }

    /**
     * 导出授权日志列表
     */
    @PreAuthorize("@ss.hasPermi('authorizationLog:authorizationLog:export')")
    @Log(title = "授权日志", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, T19 t19)
    {
        List<T19> list = t19Service.selectT19List(t19);
        ExcelUtil<T19> util = new ExcelUtil<T19>(T19.class);
        util.exportExcel(response, list, "授权日志数据");
    }

    /**
     * 获取授权日志详细信息
     */
    @PreAuthorize("@ss.hasPermi('authorizationLog:authorizationLog:query')")
    @GetMapping(value = "/{F1901}")
    public AjaxResult getInfo(@PathVariable("F1901") Long F1901)
    {
        return success(t19Service.selectT19ByF1901(F1901));
    }

    /**
     * 新增授权日志
     */
    @PreAuthorize("@ss.hasPermi('authorizationLog:authorizationLog:add')")
    @Log(title = "授权日志", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody T19 t19)
    {
        return toAjax(t19Service.insertT19(t19));
    }

    /**
     * 修改授权日志
     */
    @PreAuthorize("@ss.hasPermi('authorizationLog:authorizationLog:edit')")
    @Log(title = "授权日志", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody T19 t19)
    {
        return toAjax(t19Service.updateT19(t19));
    }

    /**
     * 删除授权日志
     */
    @PreAuthorize("@ss.hasPermi('authorizationLog:authorizationLog:remove')")
    @Log(title = "授权日志", businessType = BusinessType.DELETE)
	@DeleteMapping("/{F1901s}")
    public AjaxResult remove(@PathVariable Long[] F1901s)
    {
        return toAjax(t19Service.deleteT19ByF1901s(F1901s));
    }
}
